<template>
	<view id="app">
		<view class="container fdc">
			<view class="df fdc mtb10 bgw ">
				<view class="ptb20 plr20 f30 fw8 c000">商品信息</view>
				<view class="df ptb20 plr15 bdb1s brcce">
					<view class="w300 h180 br15 courseImg"><image :src="order.course_thumb"></image></view>
					<view class="f1 ml15 df fdc">
						<view class="h120">
							<view class="f30 c000 fw4 th2d">{{order.course_title}}</view>
							<view class="f26 c666 mt15">
								开营:{{order.start_time}}至{{order.end_time}}
							</view>
						</view>
						<view class="df aic cdebug f32 fw8">¥{{order.course_price}}</view>
					</view>
				</view>
			</view>
			<view class="bgw mt20 ver ais plr20">
				<view class="ptb20 f30 fw8 c000">订单信息</view>
				<view class=" rows plr20 ptb20  bdb1s brcce aic">
					<view class="f28 c333 ">订单号</view>
					<view class="f30 c000">{{order.order_sn}}</view>
				</view>
				<view class=" rows plr20 ptb20  bdb1s brcce aic">
					<view class="f28 c333 ">订单类型</view>
					<view class="f30 c000" v-if="order.order_type == 1 ">普通订单</view>
					<view class="f30 c000" v-if="order.order_type == 3 ">团购订单</view>
					<view class="f30 c000" v-if="order.order_type == 2 ">拼团订单</view>
				</view>
				<view class=" rows plr20 ptb20 bdb1s brcce aic" v-if="order.coupon_id >0">
					<view class="f28 c333 ">优惠券</view>
					<view class="cdebug f30 fw8">-¥{{order.coupon_price}}</view>
				</view>
				<view class=" rows plr20 ptb20 bdb1s brcce aic">
					<view class="f28 c333 ">订单金额</view>
					<view class="cdebug f30 fw8">¥{{order.order_price}}</view>
				</view>
				<view class=" rows plr20 ptb20 bdb1s brcce aic">
					<view class="f28 c333 ">下单时间</view>
					<view class="f30 c000">{{order.create_time}}</view>
				</view>
				<view class=" rows plr20 ptb20 bdb1s brcce aic" v-if="order.use_time != 0">
					<view class="f28 c333 ">核销时间</view>
					<view class="f30 c000">{{order.user_time}}</view>
				</view>
			</view>
			<view class="bgw mt20 ver ais plr20" v-if="order.pay_status == 1">
				<view class="ptb20 f30 fw8 c000">支付信息</view>
				<view class=" rows plr20 ptb20  bdb1s brcce aic">
					<view class="f28 c333 ">支付金额</view>
					<view class="cdebug f30 fw8">¥{{order.pay_price}}</view>
				</view>
				<view class=" rows plr20 ptb20 bdb1s brcce aic">
					<view class="f28 c333 ">支付交易号</view>
					<view class="f30 c000">{{order.pay_transaction_id}}</view>
				</view>
				<view class=" rows plr20 ptb20 bdb1s brcce aic">
					<view class="f28 c333 ">支付时间</view>
					<view class="f30 c000">{{order.pay_time}}</view>
				</view>
			</view>
			<view class="bgw mt20 ver ais plr20" v-if="order.is_refund == 1">
				<view class="ptb20 f30 fw8 c000">退款信息</view>
				<view class=" rows plr20 ptb20  bdb1s brcce aic">
					<view class="f28 c333 ">退款金额</view>
					<view class="cdebug f30 fw8">¥{{order.refund.refund_price}}</view>
				</view>
				<view class=" rows plr20 ptb20  bdb1s brcce aic">
					<view class="f28 c333 ">退款进度</view>
					<view class="f30 c000" v-if="order.refund.refund_status == 1">待审核</view>
					<view class="f30 c000" v-if="order.refund.refund_status == 2">待退款</view>
					<view class="f30 c000" v-if="order.refund.refund_status == 3">已退款</view>
				</view>
				<view class=" rows plr20 ptb20 bdb1s brcce aic" v-if="order.refund.refund_status == 3">
					<view class="f28 c333 ">退款交易号</view>
					<view class="f30 c000">{{order.refund.refund_transaction_id}}</view>
				</view>
				<view class=" rows plr20 ptb20 bdb1s brcce aic" v-if="order.refund.refund_status == 3">
					<view class="f28 c333 ">退款时间</view>
					<view class="f30 c000">{{order.refund.refund_time}}</view>
				</view>
			</view>
			<view class="h120"></view>
		</view>
		<view v-if="order.order_status ==5 && orderr.is_comment == 1"></view>
		<view class="footer" v-else>
			<view class="df aic jcr ptb20 bgw bdt1s brcce">
				<view class="bd1s brcce br15 plr20 ptb10 mlr10 f24 c666" v-if="order.order_status == 1" @click="handle('member/order/share?id='+order.id)">分享</view>
				<view class="bd1s brcce br15 plr20 ptb10 mlr10 f24 c666" v-if="order.order_status == 2" @click="handle('member/order/qrcode?id='+order.id)">查看券码</view>
				<view class="bd1s brcce br15 plr20 ptb10 mlr10 f24 c666" v-if="order.order_status == 5 && order.is_comment == 0" @click="handle('member/order/comment?id='+order.id)">评价</view>
				<view class="bd1s brcce br15 plr20 ptb10 mlr10 f24 c666" v-if="order.order_status < 3 && order.is_refund == 0 " @click="handle('member/order/refund?id='+order.id)">退款</view>
			</view>
		</view>
	</view>
</template>

<script>
	let that ;
	export default {
		data() {
			return {
				id:0,
				order:{},
			}
		},
		onLoad(e){
			that = this;
			if(e.id){
				this.id = e.id;
			}
			this.getDetail()
		},
		methods: {
			getDetail:function(){
				this.request({
					url:"/api/order/detail",
					data:{id:this.id},
					success:function(rlt){
						if(rlt.code == '200'){
							that.order = rlt.data;
						}
					}
				})
			},
			handle(e){
				uni.navigateTo({
					url:"/pages/"+e,
				})
			}
		}
	}
</script>

<style>

</style>
